package com.loopdependencybean;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

/**
 * @author 罗俊华
 * @since 2023/10/29 08:51
 */
@Slf4j
@Data
public class Bean1 {

    private Bean2 bean2;

    public Bean1() {
        log.debug("被创建");
    }

    @Autowired
    public void setBean2(Bean2 bean2){
        log.debug("依赖注入原始对象:{}",bean2.getClass());
        this.bean2 = bean2;
    }

    @PostConstruct
    public void init(){
        log.debug("初始化,调用此方法的是原始对象，不是aop代理对象 {}",getClass());
    }


    public void addUser(){
        log.debug("原始方法");
    }
}
